#ifndef ANIMATEDRECTITEM_H
#define ANIMATEDRECTITEM_H

#include <QGraphicsObject>
#include <QPropertyAnimation>
#include "linkedlist.h"

class AnimatedRectItem : public QGraphicsObject {
    Q_OBJECT
    Q_PROPERTY(QRectF geometry READ geometry WRITE setGeometry)

public:
    AnimatedRectItem(const QRectF &rect, int value, Node* nodePointer, QGraphicsItem *parent = nullptr);

    QRectF geometry() const;
    void setGeometry(const QRectF &rect);

    QRectF boundingRect() const override;
    void paint(QPainter *painter, const QStyleOptionGraphicsItem *option, QWidget *widget) override;

signals:
    void valueChanged(int newValue, Node* nodePointer); // 添加信号声明

protected:
    void mousePressEvent(QGraphicsSceneMouseEvent *event) override; // 添加事件处理函数声明

public:
    int data; // 添加数据成员
    Node* nodePointer; // 添加指向链表节点的指针

private:
    QRectF m_rect;
};

#endif // ANIMATEDRECTITEM_H
